import { useState } from 'react';
import pic from './assets/react.svg'

function App() {
  // 定义一个响应式数据num，和设置num的方法setNum 默认值是5
  const [num, setNum] = useState(5);
  const [str, setStr] = useState("abc");
  return <>
    <h1>图片</h1>
    <img src={pic}/>
    <h1>表单</h1>
    <p>{str}</p>
    <input type="text"
      value={str}
      onChange={e => setStr(e.target.value)} />
    <h1>useState</h1>
    <p>{num}</p>
    <button onClick={() => setNum(num + 1)}>{num}</button>
  </>
}


export default App;